3.46 \(\int \csc (e+f x) (a+b \tan ^2(e+f x))^2 \, dx\)

Optimal. Leaf size=52 \[ -\frac{a^2 \tanh ^{-1}(\cos (e+f x))}{f}+\frac{b (2 a-b) \sec (e+f x)}{f}+\frac{b^2 \sec ^3(e+f x)}{3 f} \]

[Out]

-((a^2*ArcTanh[Cos[e + f*x]])/f) + ((2*a - b)*b*Sec[e + f*x])/f + (b^2*Sec[e + f*x]^3)/(3*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0549429, antiderivative size = 52, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {3664, 390, 207} \[ -\frac{a^2 \tanh ^{-1}(\cos (e+f x))}{f}+\frac{b (2 a-b) \sec (e+f x)}{f}+\frac{b^2 \sec ^3(e+f x)}{3 f} \]

Antiderivative was successfully verified.

[In]

Int[Csc[e + f*x]*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

-((a^2*ArcTanh[Cos[e + f*x]])/f) + ((2*a - b)*b*Sec[e + f*x])/f + (b^2*Sec[e + f*x]^3)/(3*f)

Rule 3664

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = Free
Factors[Sec[e + f*x], x]}, Dist[1/(f*ff^m), Subst[Int[((-1 + ff^2*x^2)^((m - 1)/2)*(a - b + b*ff^2*x^2)^p)/x^(
m + 1), x], x, Sec[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]

Rule 390

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Int[PolynomialDivide[(a + b*x^n)
^p, (c + d*x^n)^(-q), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && IGtQ[p, 0] && ILt
Q[q, 0] && GeQ[p, -q]

Rule 207

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTanh[(Rt[b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \csc (e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx &=\frac{\operatorname{Subst}\left (\int \frac{\left (a-b+b x^2\right )^2}{-1+x^2} \, dx,x,\sec (e+f x)\right )}{f}\\ &=\frac{\operatorname{Subst}\left (\int \left ((2 a-b) b+b^2 x^2+\frac{a^2}{-1+x^2}\right ) \, dx,x,\sec (e+f x)\right )}{f}\\ &=\frac{(2 a-b) b \sec (e+f x)}{f}+\frac{b^2 \sec ^3(e+f x)}{3 f}+\frac{a^2 \operatorname{Subst}\left (\int \frac{1}{-1+x^2} \, dx,x,\sec (e+f x)\right )}{f}\\ &=-\frac{a^2 \tanh ^{-1}(\cos (e+f x))}{f}+\frac{(2 a-b) b \sec (e+f x)}{f}+\frac{b^2 \sec ^3(e+f x)}{3 f}\\ \end{align*}

Mathematica [A]  time = 0.167076, size = 66, normalized size = 1.27 \[ \frac{3 a^2 \left (\log \left (\sin \left (\frac{1}{2} (e+f x)\right )\right )-\log \left (\cos \left (\frac{1}{2} (e+f x)\right )\right )\right )+3 b (2 a-b) \sec (e+f x)+b^2 \sec ^3(e+f x)}{3 f} \]

Antiderivative was successfully verified.

[In]

Integrate[Csc[e + f*x]*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

(3*a^2*(-Log[Cos[(e + f*x)/2]] + Log[Sin[(e + f*x)/2]]) + 3*(2*a - b)*b*Sec[e + f*x] + b^2*Sec[e + f*x]^3)/(3*
f)

________________________________________________________________________________________

Maple [B]  time = 0.05, size = 124, normalized size = 2.4 \begin{align*}{\frac{{b}^{2} \left ( \sin \left ( fx+e \right ) \right ) ^{4}}{3\,f \left ( \cos \left ( fx+e \right ) \right ) ^{3}}}-{\frac{{b}^{2} \left ( \sin \left ( fx+e \right ) \right ) ^{4}}{3\,f\cos \left ( fx+e \right ) }}-{\frac{{b}^{2} \left ( \sin \left ( fx+e \right ) \right ) ^{2}\cos \left ( fx+e \right ) }{3\,f}}-{\frac{2\,{b}^{2}\cos \left ( fx+e \right ) }{3\,f}}+2\,{\frac{ab}{f\cos \left ( fx+e \right ) }}+{\frac{{a}^{2}\ln \left ( \csc \left ( fx+e \right ) -\cot \left ( fx+e \right ) \right ) }{f}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(f*x+e)*(a+b*tan(f*x+e)^2)^2,x)

[Out]

1/3/f*b^2*sin(f*x+e)^4/cos(f*x+e)^3-1/3/f*b^2*sin(f*x+e)^4/cos(f*x+e)-1/3/f*b^2*sin(f*x+e)^2*cos(f*x+e)-2/3/f*
b^2*cos(f*x+e)+2/f*a*b/cos(f*x+e)+1/f*a^2*ln(csc(f*x+e)-cot(f*x+e))

________________________________________________________________________________________

Maxima [A]  time = 1.05444, size = 92, normalized size = 1.77 \begin{align*} -\frac{3 \, a^{2} \log \left (\cos \left (f x + e\right ) + 1\right ) - 3 \, a^{2} \log \left (\cos \left (f x + e\right ) - 1\right ) - \frac{2 \,{\left (3 \,{\left (2 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} + b^{2}\right )}}{\cos \left (f x + e\right )^{3}}}{6 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

-1/6*(3*a^2*log(cos(f*x + e) + 1) - 3*a^2*log(cos(f*x + e) - 1) - 2*(3*(2*a*b - b^2)*cos(f*x + e)^2 + b^2)/cos
(f*x + e)^3)/f

________________________________________________________________________________________

Fricas [A]  time = 2.03636, size = 228, normalized size = 4.38 \begin{align*} -\frac{3 \, a^{2} \cos \left (f x + e\right )^{3} \log \left (\frac{1}{2} \, \cos \left (f x + e\right ) + \frac{1}{2}\right ) - 3 \, a^{2} \cos \left (f x + e\right )^{3} \log \left (-\frac{1}{2} \, \cos \left (f x + e\right ) + \frac{1}{2}\right ) - 6 \,{\left (2 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, b^{2}}{6 \, f \cos \left (f x + e\right )^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

-1/6*(3*a^2*cos(f*x + e)^3*log(1/2*cos(f*x + e) + 1/2) - 3*a^2*cos(f*x + e)^3*log(-1/2*cos(f*x + e) + 1/2) - 6
*(2*a*b - b^2)*cos(f*x + e)^2 - 2*b^2)/(f*cos(f*x + e)^3)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a + b \tan ^{2}{\left (e + f x \right )}\right )^{2} \csc{\left (e + f x \right )}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)*(a+b*tan(f*x+e)**2)**2,x)

[Out]

Integral((a + b*tan(e + f*x)**2)**2*csc(e + f*x), x)

________________________________________________________________________________________

Giac [B]  time = 1.70784, size = 197, normalized size = 3.79 \begin{align*} \frac{3 \, a^{2} \log \left (-\frac{\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1}\right ) + \frac{8 \,{\left (3 \, a b - b^{2} + \frac{6 \, a b{\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac{3 \, b^{2}{\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac{3 \, a b{\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )}}{{\left (\frac{\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 1\right )}^{3}}}{6 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")

[Out]

1/6*(3*a^2*log(-(cos(f*x + e) - 1)/(cos(f*x + e) + 1)) + 8*(3*a*b - b^2 + 6*a*b*(cos(f*x + e) - 1)/(cos(f*x +
e) + 1) - 3*b^2*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) + 3*a*b*(cos(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2)/((cos
(f*x + e) - 1)/(cos(f*x + e) + 1) + 1)^3)/f